<?
/*

@class 		form_element_fileField
@author		Jelle Versele
@email		me@jelleversele.be

stelt een file object voor 

*/

require_once('form/element.class.php');


class form_element_fileField extends form_element{

	/*
	instantie aanmaken 
	@param	string
	*/
	public function __construct($iName){
			
		parent::__construct($iName);
		$this -> html = new view_htmlTag('input');
			
		$this -> html -> setAttribute('type', 'file');
		$this -> html -> setAttribute('name', $iName);
		$this -> html -> setAttribute('class', 'fileField');
		$this -> html -> setAttribute('id', $iName);
		$this -> html -> setToShortTag();
		
	}
	
	// function this->getSend() overriding form_elment -> getSend() dit is een file type dus moet anders behandeld worden

	public function getSend($iKey = NULL){
	
		if(isset($_FILES[$this -> name])){
			
			if($iKey == NULL){
				return $_FILES[$this -> name];
			}else{
				return $_FILES[$this -> name][$iKey];
			}
		}else{
		
			throw new Exception("no file field in post array");
		
		}
	
	}
	
	



}


?>